#include<bits/stdc++.h>
using namespace std;
int book[10]={0};
bool find(int n){
	for(int i=0;i<5;i++){
		book[n%10]++;
		n/=10;
	}
	for(int i=0;i<10;i++){
		if(book[i]!=1) return 0;
	} 
	return 1;
}
int main(){
	int n,k=0;
	while(~scanf("%d",&n)){
		if(!n) break;
		if(k)printf("\n");
		k++;		
		bool flag=1;
		for(int i=1000;i<=50000;i++){
			int ans=i*n;
			if(ans>99999) break;
			if(find(i)||find(ans)){
				printf("%d / %0.5d = %d\n",ans,i,n);
				flag=0;
			}
			for(int j=0;j<10;j++) book[j]=0;
		}
		if(flag) printf("There are no solutions for %d.\n",n);

	}
	return 0;
}
